import request from './request';

const api_vue = process.env.VUE_APP_API;

// 二维码key生成接口
export const qrKey = () => {
  return request({
    method: 'get',
    url: `${api_vue}/login/qr/key?timestamp=${new Date().getTime()}`
  })
}

// 二维码key生成接口
export const qrCreate = key => {
  return request({
    method: 'get',
    url: `${api_vue}/login/qr/create?key=${key}&qrimg=true&timestamp=${new Date().getTime()}`
  })
}

// 二维码检测扫码状态接口
export const qrCheck = key => {
  return request({
    method: 'get',
    url: `${api_vue}/login/qr/check?key=${key}&timestamp=${new Date().getTime()}`
  })
}

// 获取登录状态
export const loginStatus = () => {
  return request({
    method: 'get',
    url: `/login/status?timestamp=${new Date().getTime()}`
  })
}

// 获取账号信息
export const userInfo = () => {
  return request({
    method: 'get',
    url: `${api_vue}/user/account?timestamp=${new Date().getTime()}`
  })
}

// 退出登录
export const logout = () => {
  return request({
    method: 'get',
    url: `${api_vue}/logout`
  })
}